{include file="public/head" /}
{include file="public/left" /}
<div class="main" style="padding:10px;">
    <div class="content">
        <span>公司通讯录</span>
        <button class="layui-btn layui-btn-sm" onclick="add()">新 增</button>
        <div></div>
    </div>
    <form class="layui-form">
        <div class="layui-form-item" style="margin-top:10px;">
            <div class="layui-input-inline">
                <select name="status">
                    <option value="0" {if $status==0} selected {/if}>全部</option>
                    <option value="1" {if $status==1} selected {/if}>技术部</option>
                    <option value="2" {if $status==2} selected {/if}>财务部</option>
                    <option value="3" {if $status==3} selected {/if}>销售部</option>

                </select>
            </div>
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i>搜索</button>
        </div>
    </form>
    <table class="layui-table">
        <thead>
        <tr>
            <th>ID</th>
            <th>OKR-O</th>
            <th>类型</th>
            <th>负责人</th>
            <th>重要性</th>
            <th>状态</th>
            <th>进度%</th>
            <th>添加时间</th>
            <th>截止时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="right" id="right_v"}
        <tr>
            <td>{$right_v.id}</td>
            <td>{$right_v.okrO}</td>
            <td>{$right_v.cat}</td>
            <td>{$right_v.people}</td>
            <td>{$right_v.iidx}</td>
            <td>
                {if $right_v['status']==1}进行中
                {elseif $right_v['status']==2}已完成
                {else/}已逾期
                {/if}

            </td>
            <td>{$right_v.pro}</td>
            <td>{$right_v.startime|date="Y-m-d"}</td>
            <td>{$right_v.ddl|date="Y-m-d"}</td>

            <td>
                <button class="layui-btn layui-btn-xs" onclick="edit({$right_v.id})">详情</button>
                <button class="layui-btn layui-btn-danger layui-btn-xs" onclick="del({$right_v.id})">删除</button>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="layui-box layui-laypage layui-laypage-default">
        <a href="/index.php/Index/index?p={$p-1}&status={$status}" class="layui-laypage-prev {if $p<=1}layui-disabled{/if}">上一页</a>
        {for start="0" end="$count"}
        {if $p == $i+1}
            <span class="layui-laypage-curr">
                <em class="layui-laypage-em"></em>
                <em>{$i+1}</em>
            </span>
        {else/}
        <a href="/index.php/Index/index?p={$i+1}&status={$status}">{$i+1}</a>
        {/if}
        {/for}
        <a href="/index.php/Index/index?p={$p+1}&status={$status}" class="layui-laypage-next {if $p>=$count}layui-disabled {/if}">下一页</a>
    </div>

<script type="text/javascript">
    function add(){
        layer.open({
            type: 2,
            title: '开始制定一个新的OKR~',
            shade: 0.3,
            area: ['480px', '440px'],
            content: '/index.php/index/add'
        });
    }
    function edit(id){
        layer.open({
            type: 2,
            title: '更新OKR的详细信息~',
            shade: 0.3,
            area: ['480px', '440px'],
            content: '/index.php/index/edit?id='+id
        });
    }
    function del(id){
        layer.confirm('您确定要删除吗？', {
            icon:3,
            btn: ['确定','取消']
        }, function(){
            $.post('/index.php/index/del',{'id':id},function(res){
                if(res.code>0){
                    layer.alert(res.msg,{icon:2});
                }else{
                    layer.msg(res.msg);
                    setTimeout(function(){window.location.reload();},1000);
                }
            },'json');
        });
    }
</script>
{include file="public/bottom" /}
